<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>登录页面</title>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>

    <link rel="stylesheet" type="text/css" href="{$admin['css']}vendor/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="{$admin['fonts']}/font-awesome-4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="{$admin['fonts']}/iconic/css/material-design-iconic-font.min.css">
    <link rel="stylesheet" type="text/css" href="{$admin['css']}/util.css">
    <link rel="stylesheet" type="text/css" href="{$admin['css']}/main.css">
</head>
<script src="{$admin['js']}/jquery.js"></script>
<script src="{$admin['vendor']}/layui/layui.all.js"></script>
<body>

<div class="limiter">
    <div class="container-login100" style="background-image: url({$admin['img']}bg-01.jpg);">
        <div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-54">
            <div class="login100-form validate-form">
                <span class="login100-form-title p-b-49">后台登录</span>

                <div class="wrap-input100 validate-input m-b-23" data-validate="请输入用户名">
                    <span class="label-input100">用户名</span>
                    <input class="input100" type="text" name="username" placeholder="请输入用户名" autocomplete="off"
                           id="username">
                    <span class="focus-input100" data-symbol="&#xf206;"></span>
                </div>

                <div class="wrap-input100 validate-input" data-validate="请输入密码">
                    <span class="label-input100">密码</span>
                    <input class="input100" type="password" name="pass" placeholder="请输入密码" id="pwd">
                    <span class="focus-input100" data-symbol="&#xf190;"></span>
                </div>


                <!--<div class="wrap-input100 validate-input" data-validate="请输入密码">-->
                <!--<span class="label-input100">密码</span>-->
                <!--<input class="input100" type="password" name="pass" placeholder="请输入密码" id="pwd">-->
                <!--<span class="focus-input100" data-symbol="&#xf190;"></span>-->

                <!--</div>-->

                <div class="text-right p-t-8 p-b-31" id="updata_code">
                    <!--<img src="{:url('login/vode')}" width="150" height="50px" id="img_code">-->
                </div>

                <div class="container-login100-form-btn">
                    <div class="wrap-login100-form-btn">
                        <div class="login100-form-bgbtn"></div>
                        <button class="login100-form-btn" id="submmit">登 录</button>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

</body>
<script>
    //切换验证码
      $("#updata_code").click(function () {
           $('#img_code').attr('src',"{:url('login/vode')}")
      })


    //登录界面
    $('#submmit').click(function () {
        var name = $("#username").val().replace(/\s*/g, "");
        var pwd = $("#pwd").val()
        post(name, pwd);
    })

    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            var name = $("#username").val().replace(/\s*/g, "");
            var pwd = $("#pwd").val()
            post(name, pwd);
        }
    })

    function post(name, pwd) {
        $.post("{:url('ajax/dologin')}", {name: name, pwd: pwd}, function (data) {
            layer.msg(data.mes, {time: 3000});
            if (data.status == 200) {
                setTimeout(function () {
                    window.location.href = "{:url('index/index')}"
                }, 2000)
            }
        })
    }

</script>

</html>